<%--
  Created by IntelliJ IDEA.
  User: USER
  Date: 2021.07.09
  Time: 22:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>无限小说网</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="layui-container">
    <form class="layui-form" action="" onsubmit="">
    <div class="layui-form-item">
        <label class="layui-form-label">关键词</label>
        <div class="layui-input-block">
            <input type="text" name="key" required  lay-verify="required" placeholder="请输入查询关键词" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">查询范围</label>
        <div class="layui-input-block">
            <select name="searchType" lay-verify="required">
                <option value="0">小说名称</option>
                <option value="1">小说简介</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
    </form>
    <div class="layui-row">
        <c:forEach var="genres" items="${allGenres}">
            <div class="layui-col-md3" style="padding: 15px;">
                <a href="/genres/list.sai?id=${genres.id}&pageNum=1&pageSize=10">${genres.name}</a>
            </div>
        </c:forEach>
    </div>
</div>
<script src="/layui/layui.js"></script>
<script>
    layui.define(function () {
        const form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            location.href="/search/"+data.field.key+"/"+data.field.searchType+"/10/1"
            return false;
        });
    });
</script>
</body>
</html>
